UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'If/lfT9Z27rIHd6j+FeN975s0z30lomJAzpEyv+afzY=' 
WHERE 
  key_id = 'dd216f3c41d45b88b228b70afb21f47d7dfe590d65ca97f788f46cba561d3705' 
  AND (
    token = 'If/lfT9Z27rIHd6j+FeN975s0z30lomJAzpEyv+afzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049