UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5OIDCZHdq8dRL3zc3hqvjBUxm9TxnJPIWUnOJhem41Y='
WHERE
key_id = '9540efd9153abf4c48689b56907e3864d215fc045ba6fbbdf7f891b2657ce0e0'
AND (
token = '5OIDCZHdq8dRL3zc3hqvjBUxm9TxnJPIWUnOJhem41Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)