UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nZs+WnUKW4fkoFsMEhcmiKYx8Ij8rqMBRADAByjLhKs=' 
WHERE 
  key_id = '383e6238aaacaa089eec4a1d6738749cbbfda4270123386b3f6d4d7696a19e6b' 
  AND (
    token = 'nZs+WnUKW4fkoFsMEhcmiKYx8Ij8rqMBRADAByjLhKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030