UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ufqZ+a+r5siPbgxPZxQE6UlWLy+Av62220PA4L++KL4='
WHERE
key_id = 'da6aef84da834a6b1077aec40796354a7f5fcdd7c0a63ad0f11d18ad072c3fd1'
AND (
token = 'ufqZ+a+r5siPbgxPZxQE6UlWLy+Av62220PA4L++KL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)