UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XIsj7+sw1KRNmQacb14pFh0KAjCStcGTEJNJzOTg24Y=' 
WHERE 
  key_id = 'ae05eb1a5649ad1934e7516632235af6ee6707d1e861ebea25543e3b200f9f17' 
  AND (
    token = 'XIsj7+sw1KRNmQacb14pFh0KAjCStcGTEJNJzOTg24Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023