UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tYhoHHgthLkMr4ABh9WCu/di1YXM3fEI12xjhIZ0obw='
WHERE
key_id = 'ff52308290070256143e86281a294677b7871486d05bf4e86f8069270e526889'
AND (
token = 'tYhoHHgthLkMr4ABh9WCu/di1YXM3fEI12xjhIZ0obw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)