UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ClBVEjv3qBK55SDDds6dvsxPDMDmfzuiESQs3/MSWq0=' 
WHERE 
  key_id = '6fe09ad8e8bed84eaceb1be3acb6c175a754aa38a48275ea2a3b7c53e3afc3f1' 
  AND (
    token = 'ClBVEjv3qBK55SDDds6dvsxPDMDmfzuiESQs3/MSWq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032