UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lsoKfchzgY14Kr+/OGrpqw4PT5qrtA448mBEQn65dlA=' 
WHERE 
  key_id = '413f8f63ab0afb61c72e6f94cac49dd9744005626ae6ae37d61702c2119e17fe' 
  AND (
    token = 'lsoKfchzgY14Kr+/OGrpqw4PT5qrtA448mBEQn65dlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032