UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+n4lbyowglK7EHMWR48JWPrQosB56NIk98kLqTUj43g=' 
WHERE 
  key_id = 'e357ab2746fb6fc388bb1734f431a24059453e3b796c7f264037516f9bee0521' 
  AND (
    token = '+n4lbyowglK7EHMWR48JWPrQosB56NIk98kLqTUj43g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048