UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBwNgAQXp9zo2Jo4lmOuQY55BEIBVFS/fmEYq+Z2YzI=' 
WHERE 
  key_id = 'b6a54cb6eece9a80cc8de05b465ef234991ec124a3a4606d94e42c3c9ef59570' 
  AND (
    token = 'TBwNgAQXp9zo2Jo4lmOuQY55BEIBVFS/fmEYq+Z2YzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029