UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dy8/pkodw/J3VrNm47WBsTwswEzp3HDkcaO6St2c6ig=' 
WHERE 
  key_id = '1fa7a126899746bfe1c573b87f13cbc9682caf19906235354b0132ab008e1413' 
  AND (
    token = 'dy8/pkodw/J3VrNm47WBsTwswEzp3HDkcaO6St2c6ig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034