UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1UmmvrK2/UeXNPmoidO8xd1UfE+RijmoXcp3Q4YIW5s=' 
WHERE 
  key_id = '12a9df33d7eea6b11a8a436a99f271db5089397dcd078b790d0446d31b7d8188' 
  AND (
    token = '1UmmvrK2/UeXNPmoidO8xd1UfE+RijmoXcp3Q4YIW5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023