UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9ZE6HgqKIkcYOarhfcxy7Qv3whTIbzz9gaDmwy8nIT8='
WHERE
key_id = '9ec29baeb477aff926e13ee733745a7b89fceec264d6f1ec2a5a21b79b61b82c'
AND (
token = '9ZE6HgqKIkcYOarhfcxy7Qv3whTIbzz9gaDmwy8nIT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)