UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHLvgcTWgXc/kSr1BIJrsTE/mZk6TH+hlVeTSOwmYuU=' 
WHERE 
  key_id = '9be18d98da0699bfd3a65a1ad7fd5831acc755278e4e0ec9f93bb1aceb7b25d7' 
  AND (
    token = 'aHLvgcTWgXc/kSr1BIJrsTE/mZk6TH+hlVeTSOwmYuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046