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