UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tJK6md0cD+S8Esy94x6o/MeMEOTnwS20Dp9B3cGk9gA=' 
WHERE 
  key_id = '904c10dfa998d718bd3bcdcfc1f116de8685dec004f550c523dccdb498286e30' 
  AND (
    token = 'tJK6md0cD+S8Esy94x6o/MeMEOTnwS20Dp9B3cGk9gA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044