UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ya+IYQA0+c6kqUkFKCWM4IjncAFRwhFe5zS/hmoNGM0='
WHERE
key_id = 'd8546245ce1340f4d703edfcca2260d38b7d7e3cdd818b1d4e03020496672943'
AND (
token = 'Ya+IYQA0+c6kqUkFKCWM4IjncAFRwhFe5zS/hmoNGM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)