UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6adRKNemYeROOta3tKDhs/aFmW4aKDDF4D4NbzZFFQ='
WHERE
key_id = '02bced56a98811dc398140df76a12a0478810223721fe1023d0866a0c049b08f'
AND (
token = 'i6adRKNemYeROOta3tKDhs/aFmW4aKDDF4D4NbzZFFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)