UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7h4u5KcpGoV8bkOCzfs79DYbZl1qxNd8SZ5wzP9e90U='
WHERE
key_id = '39a625333ed4b82b9d886815b7074a4f191efb76beed28468ed0aa6ed58a1f13'
AND (
token = '7h4u5KcpGoV8bkOCzfs79DYbZl1qxNd8SZ5wzP9e90U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)