UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oC5XLq2IJlVSsmz7HqqtYRgNnx7Ivhj6Y3alaEVfUZU=' 
WHERE 
  key_id = 'a09a2d080327657960146d33d2917c36ec1ff28da65220561924e9ac1837d161' 
  AND (
    token = 'oC5XLq2IJlVSsmz7HqqtYRgNnx7Ivhj6Y3alaEVfUZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048