UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cWAUKdiWnm4KYoJCrqn3/rZqbw18/ZtJBw7iUamllCU='
WHERE
key_id = '0b96a5d3243b6018c1c637998de7681f07e71f4c8b297032a7464d5ba290db09'
AND (
token = 'cWAUKdiWnm4KYoJCrqn3/rZqbw18/ZtJBw7iUamllCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)