UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JLJu94GGo8pwUSuEWeFWG8UAFpCJuFe/53fVJzK3fnw='
WHERE
key_id = 'a4d398a97b49dacf2905ac4ccdbd65161b19a8d1776efa667ca9a8bbd92db451'
AND (
token = 'JLJu94GGo8pwUSuEWeFWG8UAFpCJuFe/53fVJzK3fnw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)