UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8aE4g80jjLLSqZ6Bid6Mb4td2YMHc2MbXiWjte1DzLo='
WHERE
key_id = '3ec1fd0e2e7ea94bcd99c13dfdfc6784d6346c458becaf525a8c6eecec5af964'
AND (
token = '8aE4g80jjLLSqZ6Bid6Mb4td2YMHc2MbXiWjte1DzLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)