UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XgUD4KwFE9/nDt5g0eamiQGVFhmZi9bp46IgT9xgECs='
WHERE
key_id = 'f616cda1df891bdf3c9ad5c6fdfc5cff3bbe6da4cd8b8ee58a25e0e1c44d35ec'
AND (
token = 'XgUD4KwFE9/nDt5g0eamiQGVFhmZi9bp46IgT9xgECs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)