UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sBAihU1s8PpjqdCPiddL/BEHprw/41oqiyl8aCdok20=' 
WHERE 
  key_id = 'a2e4a8b4980d0faf553d55c9f335a7df42156b1ce175b16c71d8fd0a61d8ed6c' 
  AND (
    token = 'sBAihU1s8PpjqdCPiddL/BEHprw/41oqiyl8aCdok20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039