UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cr+hsvIC1d4QQcY9VRXEHE3oRgZhhD3L/XjHH0yEq4w=' 
WHERE 
  key_id = '9684aa43b390202002b77c795a0d4cdf7850c39c7f78f80faf1305eb98edf276' 
  AND (
    token = 'cr+hsvIC1d4QQcY9VRXEHE3oRgZhhD3L/XjHH0yEq4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028