UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MHAKXoUqVNLK40TlU7x7nwUoHqH9PlFhVfDjyImAL/g=' 
WHERE 
  key_id = 'dd44ade1659d21c12234366c46110311f029e1a62bd08e0131236a6b0348d786' 
  AND (
    token = 'MHAKXoUqVNLK40TlU7x7nwUoHqH9PlFhVfDjyImAL/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052