UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdzwpFDqOwEs/wLd7gwC2aGFg2Tor4P82fudd1D2T/s=' 
WHERE 
  key_id = '0e0966808fa9c5e2085521c62186989883b753ed8a871c2e7e5c97c9d168077d' 
  AND (
    token = 'bdzwpFDqOwEs/wLd7gwC2aGFg2Tor4P82fudd1D2T/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014