UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z2oJIzUpNsA0o8brAGHWad23tZrIgF6gTf+t7+x8d00='
WHERE
key_id = '1a0370dc0528f569db30bc1c131962dd2c9811f4c49bc1528ec856fd9c9eac49'
AND (
token = 'z2oJIzUpNsA0o8brAGHWad23tZrIgF6gTf+t7+x8d00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)