UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wadJrGMlQSnnNro6LmtwneoWVEJ0YFvtFoUonpGyj7w='
WHERE
key_id = '8a973b94d60fa4af23167046caa868e8d77bcf8c8df7eb48c5b56bbe92949367'
AND (
token = 'wadJrGMlQSnnNro6LmtwneoWVEJ0YFvtFoUonpGyj7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)