UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xB25aahi+yEgqEOe/55077JnXH2dOZU94F3jTvzMYf4='
WHERE
key_id = 'aaf8587cd590b747d8a3c6643d5ad86e74cec86c9b057206351c17090fb6bfb3'
AND (
token = 'xB25aahi+yEgqEOe/55077JnXH2dOZU94F3jTvzMYf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)