UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PdnrY5COdKmmhM2/G9X7HyQrlrPLBd+o5C586hmqxgg=' 
WHERE 
  key_id = '1a665c1ee49eb3c94a8501eaa1ebda5a9f5203965e24dab309202a07413a18e0' 
  AND (
    token = 'PdnrY5COdKmmhM2/G9X7HyQrlrPLBd+o5C586hmqxgg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046