UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rIEpVD0hLzhGaGSgj7drXDOhUnejx5gOBLqFkMZILJU='
WHERE
key_id = '6fe6342337bad3c82155b3a467ae2b78eeb8a23166e9a847ce7b27e1395cc311'
AND (
token = 'rIEpVD0hLzhGaGSgj7drXDOhUnejx5gOBLqFkMZILJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)