UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qGqRJNnJod9ur1nHJUqmOngrnnNCJPmnuCiNIyih1m8='
WHERE
key_id = '844ad2a7921aae9d397e25b3d37704a8f231821acaa04ff6ed98b11a7130be17'
AND (
token = 'qGqRJNnJod9ur1nHJUqmOngrnnNCJPmnuCiNIyih1m8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)