UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v29V2ZaAOfu23su8m/Fjf7k3ccKAJQWIVqkyZ1H9R48='
WHERE
key_id = '17415234e7f59641f4e52b85a8018276736bd481e666bc450826af4dd73da96c'
AND (
token = 'v29V2ZaAOfu23su8m/Fjf7k3ccKAJQWIVqkyZ1H9R48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)