UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HX9U4DZ9aOOS43kz41GRW2AyUgF7mjL1JgsRgp20mTs='
WHERE
key_id = '4c31d9d5640f6af11670b54de2bcca341fdb29397934bddc17f2b7955f8d7dc8'
AND (
token = 'HX9U4DZ9aOOS43kz41GRW2AyUgF7mjL1JgsRgp20mTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)