UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ycX9mY6uvXEiSocGTWjfbe1/pkQcsIERWcMixhJ001w=' 
WHERE 
  key_id = '977d92295cf9c73b3001723933d8d16ee3a392f7199765bceadfd4604373be0c' 
  AND (
    token = 'ycX9mY6uvXEiSocGTWjfbe1/pkQcsIERWcMixhJ001w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020