UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JSD5JWtfRswrQX2VeYPpOxz8twUXa3geDjPqnF/cwLo='
WHERE
key_id = 'd5840048065f7a62bae757fe0f48b6baaa92582efefd32bec05f15b3d58a6b56'
AND (
token = 'JSD5JWtfRswrQX2VeYPpOxz8twUXa3geDjPqnF/cwLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)