UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F8kNATEvlVgiqQDel9zLr2ZLSGAlVJM0qI0mJ0c8HmQ=' 
WHERE 
  key_id = '2dae724211e330b9547503b1581f01837291d3e008e80585e42c5152e45c1f61' 
  AND (
    token = 'F8kNATEvlVgiqQDel9zLr2ZLSGAlVJM0qI0mJ0c8HmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046