UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DJxx+aQMn4SxlJtRMIHsIAVoHZiZkOnoymNwUe3prGk='
WHERE
key_id = 'cc0892896c476e3cd6163851e43910641874ca15d91e80ac90b4e883c66f7b1e'
AND (
token = 'DJxx+aQMn4SxlJtRMIHsIAVoHZiZkOnoymNwUe3prGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)