UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Y5OVPfdfOq5a1ZneA7bkcQePOo48769RkZgUSjVzb8='
WHERE
key_id = '8bccd55fec2fa5e8e52837ff2b6b5c6ae54f9b64798d736d428614ccab6e4dbf'
AND (
token = '4Y5OVPfdfOq5a1ZneA7bkcQePOo48769RkZgUSjVzb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)