UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T3zB8mOx75HzwkuPGuWv5T1d0nNlyy9VX5z9acQ6Yrw='
WHERE
key_id = 'cb7b018e0d603b7760d994c15e06755d5df5f67521a9d6c1e0513dd3dab3fa56'
AND (
token = 'T3zB8mOx75HzwkuPGuWv5T1d0nNlyy9VX5z9acQ6Yrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)