UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9YmeXVQ5SPXwJnmQCvj2bGatLbyFsn1t1d1lkDGUME=' 
WHERE 
  key_id = '1091cd4c99fc408294a34257f53e567a40043ee19e60fa9ae1230ad1dbbda728' 
  AND (
    token = 'q9YmeXVQ5SPXwJnmQCvj2bGatLbyFsn1t1d1lkDGUME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025