UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kY4HIappWqLL7cvPiy4cXFh95M94m83dgpzpCdGfuhc='
WHERE
key_id = '6cac66ee8fe4c38d59f19ced38555aa42e4166a6e486943dad15b3e0c7abf627'
AND (
token = 'kY4HIappWqLL7cvPiy4cXFh95M94m83dgpzpCdGfuhc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)