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