UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TEpM9Eraj6HVV6Z4gQon7AxA3Bg3i/BfKUK7KjD4YUk=' 
WHERE 
  key_id = '32909b91555d8b94003848072cfd998afaa804ac259f9163c138c27d2b9517df' 
  AND (
    token = 'TEpM9Eraj6HVV6Z4gQon7AxA3Bg3i/BfKUK7KjD4YUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037