UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YYTE0Kqhb3NYMQBQvThsHza6PKqSFsFwEUCNcemjE/o='
WHERE
key_id = 'ef670e24122a35e38db60aa4d54d6bef2f14072b31f561f6415a3c0a39c6d3f7'
AND (
token = 'YYTE0Kqhb3NYMQBQvThsHza6PKqSFsFwEUCNcemjE/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)