UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C/y8qBr8cOnfU+i27GcsyzKEPySaBb7xU/HTsbp4Omc=' 
WHERE 
  key_id = '20745277ed4f040468b5764fc7f7f260f676cbae118f37c8875cf21f538191a6' 
  AND (
    token = 'C/y8qBr8cOnfU+i27GcsyzKEPySaBb7xU/HTsbp4Omc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044