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