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

Query time 0.00026