UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kSVAIlgSB8bgzfBLgCrf+uWFhZlqTkSuGM83P+aC+Bc=' 
WHERE 
  key_id = '4e619c4c9648a8a5e6bce6ba4bfda57b360fd83a140295e005a8b1dbe4144953' 
  AND (
    token = 'kSVAIlgSB8bgzfBLgCrf+uWFhZlqTkSuGM83P+aC+Bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024