UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rwv/4uq/sOeACGlZmC1ZnxfaMJoy8VrEBDTZ81iDN/c=' 
WHERE 
  key_id = '59eb122a4baa0bc8986ebbcffd09311542f46fec41621a737daae8b75c254e0e' 
  AND (
    token = 'rwv/4uq/sOeACGlZmC1ZnxfaMJoy8VrEBDTZ81iDN/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025